package mybatis.test;

import mybatis.MyBatisUtils;
import mybatis.mapper.UserMapper;
import mybatis.pojo.User;
import org.apache.ibatis.session.SqlSession;

public class updateUser {
    public static void main(String[] args) {
        SqlSession sqlSession = MyBatisUtils.getSession();
        UserMapper userMapper = sqlSession.getMapper(UserMapper.class);


        User user = userMapper.findById(2);
        user.setName("AAA");
        user.setAge(19);
        userMapper.updateById(user);

        sqlSession.commit();
        sqlSession.close();
    }

}
